import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;


public class TestDemo {
    public static void main(String[] args) {
        String str = "aa";
        System.out.println(largeGroupPositions(str));
    }

    public static List<List<Integer>> largeGroupPositions(String s) {
        List<List<Integer>> len = new ArrayList<>();
        char[] data = s.toCharArray();
        int i = 1;
        while( i < data.length){
            int count = 1;
            while(i < data.length  && data[i] == data[i-1] ){
                count++;
                i++;
            }
            if(count >= 3){
                //asList:构建List
                len.add(Arrays.asList(i-count,i-1));

            }
            i++;
        }
        return len;
    }
}
